<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>取反</title>
</head>

<body>
  <div id="box">{{text}}
    <ul>
      <li v-for="(item,index) in arr">{{item}}</li>
    </ul>
    <br>
    <button @click="fanzhuan">点击反过来</button>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>
  <script>

    Vue.config.productionTip = false;


    const vm = new Vue({
      el: '#box',
      data: {
        text: 'Hello,World',
        arr: ['帅哥', '美女', '程序员']
      },
      methods: {
        fanzhuan() {
          let temp = this.arr[0]
          this.arr.shift()
          window.alert(111)

          // this.arr.push(this.arr.shift());
          // let temp = this.arr[0]
          // let temp1 = this.arr[1]
          // let temp2 = this.arr[2]
          // this.arr[0] = temp1
          // this.arr[1] = temp2
          // this.arr[2] = temp
          // newArr.push(temp1, temp2, temp)
          // this.arr = newArr
        },
        nihao: () => {
          console.log(222);
          console.log(this);
        }
      }
    })

    vm.nihao()
    console.log(window.vm);








    console.log(vm);

  </script>
</body>

</html>